import http from '../utils/axios';  //引进http

const baseUrl = 'http://dsq.ljc.icu:8080'
interface DataType {
    code: string,
    data: {},
    msg: string
}

interface DataType1 {
    id?: number, // 序号
    brandName: string
    categoryName: string
    goodsBrandId: number
    goodsCategoryId: number
    goodsChildId: number
    goodsDesc: string
    goodsId: number
    goodsImg: string
    goodsName: string
    goodsOnTime: string
    goodsPay: string
    goodsPost: string
    goodsPriceRange: string
    goodsRec: string
    goodsSell: string
    goodsSer: string
    goodsSernum: string
    goodsShopId: number
    goodsStatus: string
    goodsSupplieId: number
    goodsTrail: string
}

interface DataType2 {
    id: number
    goodsName: string
    skuBarCode: string
    skuGoodsId: number
    skuId: number
    skuImag: string
    skuInterlinkage: string
    skuMarketValue: number
    skuMsg: string
    skuPrice: number
    skuPriceRange: string
    skuSell: number
    skuSer: string
    skuStatus: string
    skuStock: number
    skuSuccession: string
    skuUser: string
    skuVido: string
    skuYear: string
}

interface AllGoods {
    brandName: string
    categoryName: string
    goodsBrandId: number
    goodsCategoryId: number
    goodsChildId: number
    goodsDesc: string
    goodsId: number
    goodsName: string
    goodsOnTime: string
    goodsPay: string
    goodsPost: string
    goodsPriceRange: string
    goodsRec: string
    goodsSell: string
    goodsSer: string
    goodsSernum: string
    goodsShopId: number
    goodsStatus: string
    goodsSupplieId: number,
    goodsTrail: string
}

interface parentType {
    categoryCreated: string
    categoryId: number
    categoryImg: string
    categoryMsg: string
    categoryName: string
    categoryNumbe: number
    categoryParent: number
    categoryRec: string
    categorySort: string
    categoryStatus: string
}

interface brandType {
    "brandId": number,
    "brandName": string,
    "brandLogo": string,
    "brandDesc": string,
    "brandCreated": string,
    "brandCategoryId": null
}

export const getGoodsNum = (params: {}) => {
    return http.get<DataType>(baseUrl + '/shopping/goods/getGoodsNum', params)
}

export const getListFindByCon = (data: {}) => {
    return http.post<any>(baseUrl + '/shopping/goods/getListFindByCon', data)
}

export const getParentList = () => {
    return http.get<parentType[]>(baseUrl + '/shopping/category/getParentList')
}
export const getChildrenList = (params: {}) => {
    return http.get<parentType[]>(baseUrl + '/shopping/category/getList', params)
}

export const getBrandList = () => {
    return http.get<brandType[]>(baseUrl + '/shopping/brand/getList')
}
export const updateStatus = (data: {}) => {
    return http.post<any>(baseUrl + '/shopping/goods/updateStatus', data)
}

export const delDelByIds = (data: number[]) => {
    return http.post<any>(baseUrl + '/shopping/goods/delDelByIds', data)
}

export const selectDel = (params: {}) => {
    return http.post<any>(baseUrl + '/shopping/goods/selectDel', params)
}


export const getListByCon = (data: any) => {
    return http.post<any>(baseUrl + '/shopping/sku/getListByCon', data)
}

export const updateByStatus = (data: any) => {
    return http.post<DataType2[]>(baseUrl + '/shopping/sku/updateByStatus', data)
}

export const deleteSku = (params:{}) => {
    return http.get<any>(baseUrl + '/shopping/sku/deleteSku', params)
}











